﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wfMessageRecord.aspx.cs" Inherits="msBsc.WebUi.wMall.Public.wfMessageRecord" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>聊天记录</title>
    <link href="/themes/wStyle1/css/sLayout.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sHead.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sFoot.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/usermenu.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/Chat/layim.css" rel="stylesheet" />
</head>
<body>
    <div class="wf_all">
        <div id="divLoginInfo">
            <%=msBsc.WebUi.Code.QtHtmlGet.GetHeaderLoginInfo() %>
        </div>
        <div class="main-container">
            <div class="sidebar-scroll">
                <%=msBsc.WebUi.Code.QtHtmlGet.GetTouristMenuHtml() %>
            </div>
            <div class="main-Info">
                <div class="tnavigation">
                    <a class="nav" href="#">个人中心</a>&gt;
				<a class="nav-on" href="#">聊天记录</a>
                </div>

                <div id="layim_chatbox" class="layim_chatbox2">
                    <div class="layim_chat" style="height: 720px;">
                        <ul id="layim_areaone" class="layim_chatview layim_chatthis" style="height: 700px;">
                            <li style="border: 1px solid rgb(190, 190, 190); text-align: center; background-color: rgb(190, 190, 190); cursor: pointer;">
                                <span>没有任何聊天记录</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <%=msBsc.WebUi.Code.QtHtmlGet.GetFloorHtml() %>
    </div>
    <script src="/jqPlugin/js/jquery-1.8.3.min.js"></script>
    <script src="/jqPlugin/js/jBase.js"></script>
    <script src="/jqPlugin/js/jBPage.js"></script>
    <script src="/jqPlugin/layer/layer.min.js"></script>

    <script type="text/javascript">
        var senderid = GetQueryStr("senderid");
        var receiverId = GetQueryStr("receiverId");
        var exNext = true;
        $(function () {
            GetPageNext(1);
        });

        //分页请求
        function GetPageNext(pageindex) {
            var opart = new jsonRow();
            opart.AddCell("senderId", senderid);
            opart.AddCell("pageIndex", pageindex);
            opart.AddCell("ACTION", "msgRecodr");
            ajaxComm(opart);
        }

        //数据加载
        function GetRecordMessage(data, pageindex) {
            var pi = parseInt(pageindex);
            var layimli = $("#layim_areaone").children("li").first();
            if (data.records <= 0) {
                if (!exNext) return;
                //删除加载更多标签
                $(layimli).attr("onclick", "");
                $(layimli).children("span").first().html("没有更多历史记录了");
                exNext = false;
                return;
            }
            var html = "", username, userface, userClass, temphtml;
            html += '<li onclick="GetPageNext(' + (pi + 1) + ')" style="border: 1px solid rgb(190, 190, 190); text-align: center;background-color: rgb(190, 190, 190); cursor: pointer;">';
            html += '<span>查看更多</span></li>';
            $(data.rows).each(function (i, e) {
                if (receiverId == e.MESSAGE_SENDER_ID) {
                    //username = e.MESSAGE_SENDER_NICK;
                    //userface = e.SENDER_PIC;
                    userClass = "layim_chateme";
                    temphtml = '<span class="layim_chattime">' + e.MESSAGE_SEND_TIME + '</span>';
                    temphtml += '<span class="layim_chatname">' + e.MESSAGE_SENDER_NICK + '</span><img src="' + e.SENDER_PIC + '"></div>';
                }
                else {
                    //username = e.MESSAGE_RECEIVER_NICK;
                    //userface = e.REGISTER_PIC;
                    userClass = "";
                    temphtml = '<img src="' + e.SENDER_PIC + '"><span class="layim_chatname">' + e.MESSAGE_SENDER_NICK + '</span>';
                    temphtml += '<span class="layim_chattime">' + e.MESSAGE_SEND_TIME + '</span></div>';
                }
                html += '<li class="' + userClass + '"><div class="layim_chatuser">' + temphtml + '</div>';
                html += '<div class="layim_chatsay">' + e.CONTENT_FOR_MESSAGE + '<em class="layim_zero"></em></div></li>';
            });
            //删除加载更多标签
            $("#layim_areaone").children("li").first().remove();
            //添加
            $("#layim_areaone").prepend(html);
        }
    </script>
</body>
</html>
